CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
FILE(GLOB headers *.h)

SET(src 
    jpegcompressor.cpp
	jpgd.cpp
	jpge.cpp
	stb_image.c
	timer.cpp
	resampler.cpp
	)
	
IF(NOT CMAKE_BUILD_TYPE)
	SET(CMAKE_BUILD_TYPE "Debug")
ENDIF()


#IF ( MSVC )
#STRING(REPLACE "/MD"  "/MT"  CMAKE_C_FLAGS_RELWITHDEBINFO   ${CMAKE_C_FLAGS_RELWITHDEBINFO})
#STRING(REPLACE "/MDd" "/MTd" CMAKE_C_FLAGS_DEBUG            ${CMAKE_C_FLAGS_DEBUG})
#STRING(REPLACE "/MDd" "/MTd" CMAKE_C_FLAGS_DEBUG_INIT       ${CMAKE_C_FLAGS_DEBUG_INIT})
#STRING(REPLACE "/MD"  "/MT"  CMAKE_CXX_FLAGS_RELEASE        ${CMAKE_CXX_FLAGS_RELEASE})
#STRING(REPLACE "/MD"  "/MT"  CMAKE_CXX_FLAGS_RELWITHDEBINFO ${CMAKE_CXX_FLAGS_RELWITHDEBINFO})
#STRING(REPLACE "/MDd" "/MTd" CMAKE_CXX_FLAGS_DEBUG          ${CMAKE_CXX_FLAGS_DEBUG})
#STRING(REPLACE "/MDd" "/MTd" CMAKE_CXX_FLAGS_DEBUG_INIT     ${CMAKE_CXX_FLAGS_DEBUG_INIT})
#ENDIF()

	
IF(MSVC)
	ADD_DEFINITIONS(-D"_UNICODE" -D "UNICODE" -D"STRICT"  -D "JPEGCOMPRESSOR_LIB")
ENDIF()
	
SET(LIB_NAME "libjpegcompressor")
ADD_LIBRARY(libjpegcompressor STATIC ${src} ${header_files})